#ifndef IMQTTClient_h
#define IMQTTClient_h
#include "Callback.h"

class IMQTTClient {
public:
	/**
	 * @brief
	 *设置当MQTT代理接收到任何消息时调用的回调函数，包括接收消息的主题字符串、有效载荷数据及其大小。
	 *此回调由使用的BeiXiang客户端直接设置为其内部方法，因此不建议再次调用并覆盖。
	 * @param callback 接收到MQTT响应时应调用的方法
	 */
	virtual void setDataCallback(
		Callback<void, char *, uint8_t *, unsigned int>::function callback) = 0;

	virtual void setConnectCallback(Callback<void>::function callback) = 0;

	virtual bool setBufferSize(uint16_t receive_buffer_size,
								 uint16_t send_buffer_size) = 0;

	virtual uint16_t getReceiveBufferSize() = 0;

	virtual uint16_t getSendBufferSize() = 0;

	virtual void setServer(char const *domain, uint16_t port) = 0;

	virtual bool connect(char const *client_id, char const *user_name,
						 char const *password) = 0;

	virtual void disconnect() = 0;

	virtual bool loop() = 0;

	virtual bool publish(char const *topic, char const *payload,
						 size_t const &length, int qos, int retain) = 0;

	virtual bool subscribe(char const *topic, int qos) = 0;

	virtual bool unsubscribe(char const *topic) = 0;

	virtual bool connected() = 0;
};

#endif // IMQTTClient_h